package org.testing.model.questions;

import java.util.LinkedList;
import java.util.List;

import org.testing.InOutManager;
import org.testing.model.correctQuestionAnswers.CorrectAnswer;
import org.testing.model.results.Result;
import org.testing.model.userAnswers.UserAnswer;
import org.testing.model.variants.Variant;

public abstract class MultiLineVariantQuestion implements Question{
	protected CorrectAnswer correctAnswer;
	protected List<Variant> variants = new LinkedList<Variant>();
	private String bodyText;
	private final String helpText = "Choose right answer(s) (splitter is space)\n";
	
	public MultiLineVariantQuestion(String bodyText, CorrectAnswer correctAnswer) {
		this.bodyText = bodyText;
		this.correctAnswer = correctAnswer;
	}
	
	public abstract UserAnswer readUserAnswer(InOutManager inOut);


	public abstract Result check(UserAnswer answer);
		
	public String toString() {
		String result = this.bodyText + "\n";
		for(int indexVariant = 0; indexVariant<variants.size(); indexVariant++ ) {
			result += indexVariant+1 + ") " + variants.get(indexVariant).toString() + "\n" ;
		}
		return result;
	}
	
	public String getHelp() {
		
		return helpText;
	}
	
	public void addVariant(Variant variant) {
		variants.add(variant);
		
	}
	

}
